import request from "@/utils/request";
import { QueryForm, customFormType } from "./types";
import {AxiosPromise} from "axios/index";

/**
 * 获取分页列表
 * @param data
 */
export function QueryCustomList(data: QueryForm) {
  return request({
    url: "api/v1/cmsCustom/page",
    method: "get",
    params: data,
  });
}

/**
 * 添加
 *
 * @param data
 */
export function addCustom(data: customFormType) {
	return request({
		url: '/api/v1/cmsCustom/create',
		method: 'post',
		data: data
	});
}

/**
 * 修改
 *
 * @param id
 * @param data
 */
export function updateCustom(id: number, data: customFormType) {
	return request({
		url: '/api/v1/cmsCustom/' + id,
		method: 'put',
		data: data
	});
}

/**
 * 批量删除，多个以英文逗号(,)分割
 *
 * @param ids
 */
export function deleteCustoms(ids: string) {
	return request({
		url: '/api/v1/cmsCustom/' + ids,
		method: 'delete'
	});
}

/**
 * 获取详情
 *
 * @param id
 */
export function getCustomForm(id: number): AxiosPromise<customFormType> {
	return request({
		url: '/api/v1/cmsCustom/' + id + '',
		method: 'get'
	});
}

